#!/usr/bin/python3
# by Sun Smallwhite <niasw@pku.edu.cn>(https://github.com/niasw)

import sw.io.adaptor;
import sys;
import os;

if (__name__=='__main__'):
  '''
# put the input file in ../tmp/
# python clustovec.py indexstart=1
  '''
  indexstart=1;
  if (len(sys.argv)>=2):
    indexstart=int(sys.argv[1]);
  lis=os.listdir('../tmp');
  for it in lis:
    print(it);
    if (not ('old' in it)):
      cluslist=sw.io.loadJSON.loadJSON('../tmp/'+it);
      clusvec=sw.io.adaptor.clus2vec(cluslist,indexstart=indexstart);
      sw.io.adaptor.vec2csv(clusvec,'../tmp/old.'+it);

